﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Imaginecup.gameState.scroll;

namespace Imaginecup.scroll
{
    public class WidthRightScroll:IScrollProcess
       {
        private double m_CurrentXPos;
        private int m_MaxX ;
        private double m_ScrollSpeed;
        private bool m_bEnd;

        public WidthRightScroll(double initXPos, double scrollSpeed, int maxX)
        {
            m_CurrentXPos = initXPos;
            m_ScrollSpeed = scrollSpeed;
            m_bEnd = false;
            m_MaxX = maxX;
        }
        public void Scroll(Microsoft.Xna.Framework.GameTime gameTime)
        {
            m_CurrentXPos += (gameTime.ElapsedGameTime.TotalSeconds * m_ScrollSpeed);

            if (m_CurrentXPos > m_MaxX)
            {
                m_CurrentXPos = m_MaxX;
                m_bEnd = true;
            }
        }

        public Vector2 GetCurrentStartPos()
        {
            return new Vector2( (float)m_CurrentXPos , 0);
        }

        public bool IsScrollEnd()
        {
            return m_bEnd;
        }
    }
}
